<!--# 
layout("/layout/register_login.html"){ 
 #-->
<div class="row">
	<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4 center">
		<div class="col-sm-offset-4 col-sm-8">
			<h3>
				<i class="fa fa-user"></i> 注册用户
			</h3>
		</div>
		<form class="form-horizontal" method="post" action="${base}/register">
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-4 control-label">昵称</label>
				<div class="col-sm-8">
					<input type="text"  class="form-control" id="nickName"  name="nickName"  placeholder="请输入昵称" data-type='required'>
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail3" class="col-sm-4 control-label">用户名</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" id="userName" name="name" placeholder="请输入用户" data-type='required'>
				</div>
			</div>

			<div class="form-group">
				<label for="inputEmail3" class="col-sm-4 control-label">邮箱</label>
				<div class="col-sm-8">
					<input type="email" class="form-control" id="email" name="email" placeholder="请输入邮箱地址" data-type='email'>
				</div>
			</div>


			<div class="form-group">
				<label for="inputPassword3" class="col-sm-4 control-label">密码</label>
				<div class="col-sm-8">
					<input type="password" class="form-control" id="password" name="password" placeholder="请输入密码" data-type='password'>
				</div>
			</div>

			<div class="form-group">
				<label for="inputPassword3" class="col-sm-4 control-label">确认密码</label>
				<div class="col-sm-8">
					<input type="password" class="form-control" id="repassword" placeholder="请再次输入密码">
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-4 col-sm-8">
					<button type="button" class="btn btn-large btn-block btn-primary" onclick="doRegister()">确认注册</button>
					<h3>
						<i class="fa fa-qq"></i> <i class="fa fa-wechat"></i> <i class="fa fa-github"></i> <i class="fa fa-weibo"></i>
					</h3>
				</div>
			</div>

		</form>
	</div>
</div>
<script type="text/javascript">
<!--
	var error = '${error!}';
	$(function(){
		if (error) {
			validationFail(error, $('.btn-primary'));
		}
	})
	function doRegister() {
		if ($('.form-horizontal').validation(function(status, dom, errorMsg, defaultValue) {
			status ? function() {
				$(dom).parent().parent().removeClass('has-error').addClass('has-success');
			}.call() : function() {
				validationFail(errorMsg, dom);
				$(dom).parent().parent().removeClass('has-success').addClass('has-error');
			}.call();
		})) {
			if ($('#password').val() ==$('#repassword').val()) {
				$('#repassword').parent().parent().removeClass('has-error').addClass('has-success');
				$('.form-horizontal').submit();
			}else{
				validationFail("两次输入密码不同", $('#repassword'));
				$('#repassword').parent().parent().removeClass('has-success').addClass('has-error');
			}
		}
	}
//-->
</script>
<!--# } #-->